import http from "./http";
import qs from "qs";
import axios from 'axios';

// 会员列表
export const getMemberInfoList = (params, that) => {
  return http.get("/member/getMemberInfoList", params, {
    cancelToken: new axios.CancelToken(function executor(c) {
      // 设置 cancel token
      that.source = c;
    })
  });
}
//添加会员
export const memberInit = (params) => {
  return http.post("/member/memberInit", params)
}
//续费列表
export const getRobotRenewInfoList = (params) => {
  return http.get("/member/getRobotRenewInfoList", params)
}
//正式用户续费列表
export const getRobotRenewList = (params) => {
  return http.get("/member/getRobotRenewList", params)
}
// 密码重置
export const resetPwd = (params) => {
  return http.post("/member/resetPwd", qs.stringify(params))
}
// 二次验证重置
export const adminReset = (params) => {
  return http.post("/google/adminReset", qs.stringify(params))
}
// 获取代理统计
export const getAgentCount = (params, that) => {
  return http.get("/member/getAgentCount", params, {
    cancelToken: new axios.CancelToken(function executor(c) {
      // 设置 cancel token
      that.source = c;
    })
  })
}
// 获取续费记录
export const getRenewRecords = (params, that) => {
  return http.get("/member/getRenewRecords", params, {
    cancelToken: new axios.CancelToken(function executor(c) {
      // 设置 cancel token
      that.source = c;
    })
  })
}

// 获取直属续费
export const getMyRenewRecords = (params, that) => {
  return http.get("/member/getMyRenewRecords", params, {
    cancelToken: new axios.CancelToken(function executor(c) {
      // 设置 cancel token
      that.source = c;
    })
  })
}
// 获取平台
export const renewRecords = (params) => {
  return http.delete("/member/renew-records", params)
}
// 修改状态
export const updateUserStatus = (params) => {
  return http.post("/member/updateUserStatus", qs.stringify(params))
}
// 获取平台
export const getPlatform = (params) => {
  return http.get("/member/getPlatform", params)
}
// 续费操作
export const doUserRenew = (params) => {
  return http.post("/member/doUserRenew", qs.stringify(params))
}
// 修改会员信息
export const updateUserInfo = (params) => {
  return http.post("/member/updateUserInfo", params)
}

// 获取添加会员中的账号类型
export const getUserPermission = () => {
  return http.get("/member/getUserPermission")
}
//获取所有类型
export const getPermissionInfo = () => {
  return http.get("/member/getPermissionInfo")
}
// eslint-disable-next-line import/no-anonymous-default-export
export default {
  getMemberInfoList,
  memberInit,
  getRobotRenewInfoList,
  getRobotRenewList,
  resetPwd,
  adminReset,
  getAgentCount,
  renewRecords,
  getRenewRecords,
  updateUserStatus,
  getPlatform,
  doUserRenew,
  updateUserInfo,
  getUserPermission
}